home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 12
/
Aminet 12 (1996)(GTI - Schatztruhe)[!][Jun 1996].iso
/
Aminet
/
mus
/
play
/
MultiPlyr132sr.lha
/
audiodev.asm
< prev
next >
Wrap
Assembly Source File
|
1992-09-14
|
4KB
|
135 lines
* MultiPlayer
* Copyright (C) 1992 Bryan Ford
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* I (the author of MultiPlayer) can be contacted on the Internet at
* "bryan.ford@m.cc.utah.edu". See "Player.doc" for other addresses.
*
* $Id: audiodev.asm,v 4.1 92/06/21 11:15:10 BAF Exp Locker: BAF $
*
include "exec/types.i"
include "exec/io.i"
include "exec/funcdef.i"
include "exec/exec_lib.i"
include "devices/audio.i"
include "hardware/custom.i"
include "hardware/dmabits.i"
include "player.i"
code text
xdef allocaudio,freeaudio
xref diemes
xref _SysBase
*** Allocate all the audio channels from the audio.device
allocaudio
bsr freeaudio
move.l a6,-(sp)
move.l _SysBase(a4),a6
moveq #-1,d0 ; Allocate signal
jsr _LVOAllocSignal(a6)
move.b d0,sigbit(a4)
bmi 99$
move.b d0,port+MP_SIGBIT(a4) ; Setup MsgPort
move.b #NT_MSGPORT,port+LN_TYPE(a4)
suba.l a1,a1
jsr _LVOFindTask(a6)
move.l d0,port+MP_SIGTASK(a4)
lea port+MP_MSGLIST(a4),a0
NEWLIST a0
lea port(a4),a0
move.l a0,req+MN_REPLYPORT(a4)
lea req(a4),a1 ; Open audio.device and allocate channels
lea audiodevname(a4),a0
moveq #0,d0
moveq #0,d1
jsr _LVOOpenDevice(a6)
tst.b d0
bne 99$
st.b alloced(a4)
move.l (sp)+,a6
rts
99$ lea noaudtext(a4),a0
bra diemes
*** Free the audio.device channels
freeaudio
move.l a6,-(sp)
move.l _SysBase(a4),a6
tst.b alloced(a4)
beq.s 19$
lea CUSTOM,a0 ; Shut up all sound
move.w #DMAF_AUD0!DMAF_AUD1!DMAF_AUD2!DMAF_AUD3,dmacon(a0)
clr.w aud0+ac_dat(a0)
clr.w aud1+ac_dat(a0)
clr.w aud2+ac_dat(a0)
clr.w aud3+ac_dat(a0)
clr.b alloced(a4) ; Close the audio.device
lea req(a4),a1
jsr _LVOCloseDevice(a6)
19$
moveq #0,d0 ; Free signal
move.b sigbit(a4),d0
bmi.s 29$
jsr _LVOFreeSignal(a6)
st.b sigbit(a4)
29$
move.l (sp)+,a6
rts
data __MERGED
req: dc.l 0,0
dc.b NT_MESSAGE,127 ;use maximum priority (127)
dc.l 0,0 ;name, replyport
dc.w ioa_SIZEOF ;length
dc.l 0 ;io_Device
dc.l 0 ;io_Unit
dc.w 0 ;io_Command
dc.b 0,0 ;io_Flags, io_Error
dc.w 0 ;ioa_AllocKey
dc.l allmask ;ioa_Data
dc.l 1 ;ioa_Length
9$
ds.b ioa_SIZEOF-(9$-req)
noaudtext dc.b "Audio hardware in use",0
audiodevname: dc.b 'audio.device',0
sigbit dc.b -1
allmask dc.b $f
bss __MERGED
port ds.b MP_SIZE
alloced ds.b 1
end